<%@ page language="java"  pageEncoding="UTF-8"%>
<%@taglib uri="/WEB-INF/struts-tags.tld" prefix="s"%>
<%@taglib uri="/WEB-INF/wm.tld" prefix="wm"%>
<!DOCTYPE html>
<html lang="zh">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>沈阳外卖网</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- Bootstrap -->
<link href="publicui/bootstrap/css/bootstrap.min.css" rel="stylesheet" media="screen" />
<!--[if lt IE 9]>
  <script src="public/js/html5shiv.js"></script>
<![endif]-->
<!-- application  -->
<link href="css/head.css" rel="stylesheet" />
<link href="css/foot.css" rel="stylesheet" />
<link href="css/checkorder.css" rel="stylesheet" />
</head>

<body>
<div class="head">
   <s:action name="top" executeResult="true"></s:action>
</div>
<!---/body   -->
<div class="content" > 
<!--   content  -->
<form action="">
<div class="full-content-wrapper">
	<div id="cart">
            
          
<nav class="clearfix">
  
</nav>

<div class="container cart-checkout">

  
  <header class="cart-header clearfix">
  <div id="restaurant" class="restaurant-info clearfix" data-restaurant="16814">
    <a class="logo" target="_blank" href="/story"><img src="饭店logo"></a>
    <div class="info">
      <a class="name" target="_blank" href="/story"><s:property value="restaurant.resName"/></a>
      <span class="flavor"><s:property value="restaurant.resTaste"/></span>
    </div>
  </div>

  <div class="flow">
  <span class="first">选择美食</span>
  <span>订单信息</span>
  <span class="last">保存订单</span>
  <i></i>
  </div>

</header>
  <section class="module-basket">
<table id="basket" class="cart-basket">
  <colgroup>
    <col class="basket-col-first">
    <col class="basket-col-second">
    <col class="basket-col-normal">
    <col class="basket-col-normal">
    <col class="basket-col-normal">
    <col class="basket-col-last">
  </colgroup>
  <thead class="table-gradient-bg">
    <tr>
      <th class="basket-th" colspan="2"><h2 class="basket-header">购物车</h2></th>
      <th class="basket-th">单价</th>
      <th class="basket-th">数量</th>
      <th class="basket-th">总计</th>
      <th class="basket-th action"></th>
    </tr>
  </thead>

  <tbody id="basket_wrapper">
    
    
            <tr>
            <td class="basket-td basket-dish-container" colspan="6">

        <table class="basket-dish ">
          <colgroup>
            <col class="dish-col-name">
            <col class="dish-col-price">
            <col class="dish-col-quantity">
            <col class="dish-col-subtotal">
            <col class="dish-col-action">
          </colgroup>
          <tbody>
          <s:if test="orders.menuList!=null">
          <s:iterator id="ml" value="%{orders.menuList}">
          <tr>
            <td class="dish-name"><s:property value="#ml.menuName"/></td>
            <td class="dish-price" val="<s:property value="#ml.priceShow"/>">
              <span class="symbol-rmb">¥</span>
              <s:property value="#ml.priceShow"/>            </td>
            <td class="dish-quantity dish_quantity">
              <a class="action" href="shopping.action?action=reduce&resId=<s:property value="orders.resId"/>&menuName=<s:property value="#ml.menuName"/>&copies=<s:property value="#ml.copies"/>&resName=<s:property value="orders.resName"/>&returnURL=checkOrder"><i class="icon-minus"></i></a>
              <input class="input" type="text" autocomplete="off" value="<s:property value="copies"/>" food_id="2141755" group_id="0" parent_entity_id="0">
              <a class="action" href="shopping.action?action=add&resId=<s:property value="orders.resId"/>&menuName=<s:property value="#ml.menuName"/>&copies=<s:property value="#ml.copies"/>&resName=<s:property value="orders.resName"/>&returnURL=checkOrder"><i class="icon-add"></i></a>
            </td>
            <td class="dish-subtotal" value="<s:property value="#ml.totalPriceShow"/>">
              <span class="symbol-rmb">¥</span>
              <s:property value="#ml.totalPriceShow"/>            </td>
            <td class="dish-action"><a href="shopping.action?action=removeById&resId=<s:property value="orders.resId"/>&menuName=<s:property value="#ml.menuName"/>&copies=<s:property value="#ml.copies"/>&resName=<s:property value="orders.resName"/>&returnURL=checkOrder" class="dish-del">×</a></td>
          </tr>
		  </s:iterator>
		  </s:if>
          </tbody>
        </table>
      </td>
    </tr>
        
                  </tbody>

  <tfoot class="table-gradient-bg">
    <tr>
      <td class="basket-tfoot" colspan="6">
                <div id="note_wrapper" class="float-r">
  <div class="basket-summary">
    <i class="icon-notes"></i>
    <!-- <input id="memo" name="memo" type="text" placeholder="给餐厅留言" onmousedown="this.placeholder=''"> -->
    订餐电话：<span class="total" id="total_price_basket">46461316</span>
  </div>

  <div id="note_bubble" class="note-bubble">
        <div id="quick_notes" class="quick-notes clearfix">
      <a class="bubble-triangle">不吃辣</a>
      <a>辣一点</a>
      <a>多加米</a>
      <a>么零钱</a>
    </div>
      </div>
</div>

        <div class="float-r">
                    <div class="basket-summary">
                        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;共<span id="total_quantity_2"><s:property value="orders.totalCopies"/></span>份美食&nbsp;&nbsp;
            应付金额：<span class="symbol-rmb">¥</span> <span class="total" id="total_price_basket"><s:property value="orders.totalPriceShow"/></span>
          </div>
        </div>
      </td>
    </tr>
  </tfoot>
</table>


</section>
  <!-- <section class="module-addr mod_addr">
  <h2>
    <div class="col-left">
      <i class="icon-addr"></i>
      <strong>送达地址：</strong>
    </div>

    <div class="col-right">
      <span class="module-info mod_info">
              请选择地址
            </span>
            <s:if test="addressList!=null"><a class="hint" href="javascript:address();">[选择地址]</a></s:if>
       <ul class="form-list addr-list" id="addr_list" style="list-style:none">
            <li id="addr_new" class="relative current">
        		<input type="radio" name="optionAddress" id="newAddrRadio">
        		<label for="newAddrRadio" data-id="new">
                <input id="addr" class="addr" type="text" placeholder="外卖送到的地址">
          		<input id="phone" class="tel" type="text" placeholder="联系电话">
          		<input id="backPhone" class="tel-bk" type="text" placeholder="备选电话（选填）">
          		<input id="linkman" class="linkman" type="text" placeholder="联系人">
                </label>
      		</li>
    	</ul>
    </div>
  </h2>
</section>-->
  <div class="overlay-mask hide" id="so_mask"></div>
  	 本店暂不支持网上订餐，请电话联系我们！<br/>
     <button id="confirm_order" class="btn-checkout" type="button" data-loading="正在提交…" onclick="save();">保存订单</button>
     <s:if test="#session.user_session!=null">
     <input type="hidden" id="sess" name="hiddenField" value="1"> 
     </s:if>
     <s:if test="#session.user_session==null">
     <input type="hidden" id="sess" name="hiddenField" value="0"> 
     </s:if>
  </div>
        </div>
</div>
</form>
<!--   /content  -->
  <s:action name="foot" executeResult="true"></s:action>
</div>
<!--  alert div start---->
<div id="copy_dlg_restaurant"  class="restaurant-hover-dlg right hide" >
  <div class="wrapper dark_shadow">
    <div class="callout_tip"></div>
    <div class="detail"> </div>
  </div>
</div>
<!--  alert div  end ---->

<!---/body   --> 


<script src="publicui/js/jquery-1.8.3.js"></script> 
<script src="publicui/jquery-ui/js/jquery-ui-1.9.2.custom.js"></script> 
<script src="publicui/bootstrap/js/bootstrap.min.js"></script> 
<script src="js/head.js"></script> 
<!--
<div id="myModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
  <div class="modal-header">
    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
    <h3 id="myModalLabel">选择地址</h3>
  </div>
  <div class="modal-body">
    <ul class="form-list addr-list" id="addr_list" style="list-style:none">
    <s:if test="addressList!=null">
    <s:iterator id="al" value="%{addressList}">
       <li id="addr_new" class="relative current">
     		<input type="radio" name="optionAddress" id="newAddrRadio" onclick="updateAddress('<s:property value="#al.address"/>','<s:property value="#al.phone"/>','<s:property value="#al.backPhone"/>','<s:property value="#al.linkman"/>');">
     		<label for="newAddrRadio" data-id="new">
            <input class="addr" type="text" placeholder="<s:property value="#al.address"/>">
       		<input class="tel" type="text" placeholder="<s:property value="#al.phone"/>">
       		<input class="tel-bk" type="text" placeholder="<s:property value="#al.backPhone"/>">
       		<input class="tel-bk" type="text" placeholder="<s:property value="#al.linkman"/>">
           	</label>
   		</li>
    </s:iterator>
    </s:if>
    </ul>
  </div>
  <div class="modal-footer">
  	<button class="btn btn-primary" data-dismiss="modal" aria-hidden="true" >保存</button>
    <button class="btn" data-dismiss="modal" aria-hidden="true" onclick="removeAddress();">取消</button>
  </div>
</div>
--> 
<div id="alert"></div>
<script type="text/javascript">
var oldaddr="";
var oldphone="";
var oldbackPhone="";
var oldlinkman="";
function address(){
	oldaddr=$('#addr').attr("placeholder");
	oldphone=$('#phone').attr("placeholder");
	oldbackPhone=$('#backPhone').attr("placeholder");
	oldlinkman=$('#linkman').attr("placeholder");
	$('#myModal').modal();
}
function updateAddress(addr,phone,backPhone,linkman){
	$('#addr').attr("placeholder",addr);
	$('#phone').attr("placeholder",phone);
	$('#backPhone').attr("placeholder",backPhone);
	$('#linkman').attr("placeholder",linkman);
}
function removeAddress(){
	$('#addr').attr("placeholder",oldaddr);
	$('#phone').attr("placeholder",oldphone);
	$('#backPhone').attr("placeholder",oldbackPhone);
	$('#linkman').attr("placeholder",oldlinkman);
}
function save(){
    var sess=$('#sess').val();
    if(sess==0){
    	window.location.href="login.action?action=index&returnURL="+encodeURIComponent(window.location.href);
    }else{
    	$.ajax({
			url:"orders.action?action=save",
			dataType:"html", 
			success: function(html){
				$('#alert').html(html);
			}
		});
    }
	
}
</script>
</body>
</html>
